import sys, os, hashlib, StringIO
import bencode


with open("torrents/file.torrent", "rb") as file:
    content = file.read()
    metainfo = bencode.bdecode(content)
    info = metainfo['info']
    hash_info = hashlib.sha1(bencode.bencode(info)).hexdigest()  
